home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / DiskUtil / Crunch / XFH.lha / XFH / SRC / DODOS.ASM < prev    next >
Assembly Source File  |  1993-03-02  |  2KB  |  86 lines

  1. *  DoDOS.asm - Call function from an AmigaDOS process context.
  2. *  Copyright (C) 1991, 1992, 1993 Kristian Nielsen.
  3. *
  4. *  This file is part of XFH, the compressing file system handler.
  5. *
  6. *  This program is free software; you can redistribute it and/or modify
  7. *  it under the terms of the GNU General Public License as published by
  8. *  the Free Software Foundation; either version 2 of the License, or
  9. *  (at your option) any later version.
  10. *
  11. *  This program is distributed in the hope that it will be useful,
  12. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. *  GNU General Public License for more details.
  15. *
  16. *  You should have received a copy of the GNU General Public License
  17. *  along with this program; if not, write to the Free Software
  18. *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20.  
  21. *************************************************************************
  22. *
  23. * Project: CFS
  24. * File: DoDOS.asm
  25. *
  26. * Kludge to make a call to DeviceProc. This process executes a function
  27. * for the handler, permitting AmigaDOS calls.
  28. *
  29. *************************************************************************
  30.  
  31.     INCLUDE    "exec/types.i"
  32.     INCLUDE    "libraries/dosextens.i"
  33.     INCLUDE    "exec/ports.i"
  34.  
  35.     SECTION    DoDeviceProc,CODE
  36.  
  37.     XDEF    _DoDOS
  38.     XDEF    _DoDOSSeg
  39.  
  40.     XREF    _LinkerDB
  41.     XREF    _SysBase
  42.  
  43.     XREF    _LVOFindTask
  44.     XREF    _LVOWaitPort
  45.     XREF    _LVOGetMsg
  46.     XREF    _LVOForbid
  47.     XREF    _LVOReplyMsg
  48.  
  49. _DoDOSSeg
  50.     dc.l    0        ;Dummy seglist entry.
  51. _DoDOS
  52.     lea    _LinkerDB,a4
  53.     move.l    _SysBase(a4),a6
  54.     suba.l    a1,a1
  55.     jsr    _LVOFindTask(a6)
  56.     movea.l    d0,a2
  57.     lea    pr_MsgPort(a2),a2
  58. msgloop
  59.     movea.l    a2,a0
  60.     jsr    _LVOWaitPort(a6)
  61.     movea.l    a2,a0
  62.     jsr    _LVOGetMsg(a6)
  63.     tst.l    d0
  64.     beq.s    msgloop
  65.  
  66. * The first long word after the message structure is the address of
  67. * the function to call. The message is passed in a0.
  68.  
  69.     movea.l    d0,a2
  70.     movea.l    a2,a0
  71.     movea.l    MN_SIZE(a0),a1
  72.     jsr    (a1)
  73.  
  74. * Now reply the message, and exit.
  75.  
  76.     jsr    _LVOForbid(a6)    ;Musn't unload until we're done.
  77.     movea.l    a2,a1
  78.     jsr    _LVOReplyMsg(a6)
  79.  
  80. * Exit under the spell of the Forbid().
  81.  
  82.     rts
  83.  
  84.     END
  85.  
  86.